package com.demo.design.stractural.composite;

import java.util.ArrayList;
import java.util.List;

public class BranchNode implements TreeNode {
    private List<TreeNode> child = new ArrayList<>();

    @Override
    public void addNode(TreeNode treeNode) {
        child.add(treeNode);
    }

    @Override
    public void operate() {
        for (TreeNode treeNode : child) {
            treeNode.operate();
        }
    }
}
